package com.ctsi.ssdc.admin.repository;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

import com.ctsi.ssdc.admin.domain.CscpRoles;
import com.ctsi.ssdc.admin.domain.CscpRolesExample;
import com.ctsi.ssdc.database.annotation.InjectByDataBaseType;
import com.ctsi.ssdc.database.enums.EnumDatabaseName;

/**
 * @author MyBatis Generator
*/
@InjectByDataBaseType(includes= {EnumDatabaseName.ORACLE})
public interface CscpRolesRepository {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @SelectProvider(type=CscpRolesSqlProvider.class, method="countByExample")
    long countByExample(CscpRolesExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @DeleteProvider(type=CscpRolesSqlProvider.class, method="deleteByExample")
    int deleteByExample(CscpRolesExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @Delete({
        "delete from cscp_roles",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @Insert({
        "insert into cscp_roles (name, role_extent, ",
        "parent_id, icon)",
        "values (#{name,jdbcType=VARCHAR}, #{roleExtent,jdbcType=VARCHAR}, ",
        "#{parentId,jdbcType=INTEGER}, #{icon,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true, keyProperty="id")
    int insert(CscpRoles record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @InsertProvider(type=CscpRolesSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true, keyProperty="id")
    int insertSelective(CscpRoles record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @SelectProvider(type=CscpRolesSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_extent", property="roleExtent", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.INTEGER),
        @Result(column="icon", property="icon", jdbcType=JdbcType.VARCHAR)
    })
    List<CscpRoles> selectByExample(CscpRolesExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @Select({
        "select",
        "id, name, role_extent, parent_id, icon",
        "from cscp_roles",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_extent", property="roleExtent", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.INTEGER),
        @Result(column="icon", property="icon", jdbcType=JdbcType.VARCHAR)
    })
    CscpRoles selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @UpdateProvider(type=CscpRolesSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CscpRoles record, @Param("example") CscpRolesExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @UpdateProvider(type=CscpRolesSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CscpRoles record, @Param("example") CscpRolesExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @UpdateProvider(type=CscpRolesSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CscpRoles record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @Update({
        "update cscp_roles",
        "set name = #{name,jdbcType=VARCHAR},",
          "role_extent = #{roleExtent,jdbcType=VARCHAR},",
          "parent_id = #{parentId,jdbcType=INTEGER},",
          "icon = #{icon,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CscpRoles record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_roles
     *
     * @mbg.generated Mon May 07 08:50:31 CST 2018
     */
    @SelectProvider(type=CscpRolesSqlProvider.class, method="selectByExampleWithPage")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="role_extent", property="roleExtent", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.INTEGER),
        @Result(column="icon", property="icon", jdbcType=JdbcType.VARCHAR)
    })
    List<CscpRoles> selectByExamplewithPage(CscpRolesExample example);
}